package com.hqd.ch03.v46.boot.autoconfigure;

import com.hqd.ch03.v46.context.annotation.Configuration;
import com.hqd.ch03.v46.core.annotation.AliasFor;

import java.lang.annotation.*;

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Configuration(proxyBeanMethods = false)
@AutoConfigureBefore
@AutoConfigureAfter
public @interface AutoConfiguration {

    /**
     * Explicitly specify the name of the Spring bean definition associated with the
     * {@code @AutoConfiguration} class. If left unspecified (the common case), a bean
     * name will be automatically generated.
     * <p>
     * The custom name applies only if the {@code @AutoConfiguration} class is picked up
     * via component scanning or supplied directly to an
     * {@link AnnotationConfigApplicationContext}. If the {@code @AutoConfiguration} class
     * is registered as a traditional XML bean definition, the name/id of the bean element
     * will take precedence.
     *
     * @return the explicit component name, if any (or empty String otherwise)
     * @see AnnotationBeanNameGenerator
     */
    @AliasFor(annotation = Configuration.class)
    String value() default "";

    /**
     * The auto-configure classes that should have not yet been applied.
     *
     * @return the classes
     */
    @AliasFor(annotation = AutoConfigureBefore.class, attribute = "value")
    Class<?>[] before() default {};

    /**
     * The names of the auto-configure classes that should have not yet been applied.
     *
     * @return the class names
     */
    @AliasFor(annotation = AutoConfigureBefore.class, attribute = "name")
    String[] beforeName() default {};

    /**
     * The auto-configure classes that should have already been applied.
     *
     * @return the classes
     */
    @AliasFor(annotation = AutoConfigureAfter.class, attribute = "value")
    Class<?>[] after() default {};

    /**
     * The names of the auto-configure classes that should have already been applied.
     *
     * @return the class names
     */
    @AliasFor(annotation = AutoConfigureAfter.class, attribute = "name")
    String[] afterName() default {};

}
